package string;

/**
 * static String valueOf(XXX x)
 * String提供了一套重载的valueOf静态方法,作用是将java中其它类型转换为String
 */
public class ValueOfDemo {
    public static void main(String[] args) {
        int a = 123;
        String s1 = String.valueOf(a);//s1 = "123";
        System.out.println(s1);

        double dou = 123.123;
        String s2 = String.valueOf(dou);//s2 = "123.123";
        System.out.println(s2);

        String s3 = a + "";//任何类型与String连接,结果都是字符串,性能略低
        System.out.println(s3);

    }
}







